﻿using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common
{
    public class AutoUpdateConfigModel:ObservableObject
    {
        public ObjectId _id { get; set; }

        /// <summary>
        /// run下载路径
        /// </summary>
        ObjectId runExeDownLoadPath;

        /// <summary>
        /// run得本地路径
        /// </summary>
        string runExeLocalPath = "";

        string runExeName = "Run";

        /// <summary>
        /// 启动程序
        /// </summary>
        string startExeLocalPath = "";
        ObjectId startExePath;
        string startExeName = "AnesAutoUpdate.exe";

        Version serverVersion = new Version("1.0.0");
        long serverVersionId = 0;
        string updateDetial = "更新详情";
        string updatePath = "";
        string localRootPath = "c:/config/";
        string xuNiPath = "c:/AnesSystem/";
        List<string> killProcess;
        List<string> startProcess;
        bool isReTipUpdate = false;
        string zhiDingDir = "";
        /// <summary>
        /// 强制删除
        /// </summary>
        string qzsc = "false";
        string qzgx = "false";
        bool isDeleted = false;
        string isUpdateRunExe = "false";
        string isUpdateMethodExe = "true";
        string methodExeFullPath = "";
        string realStartExePath = "c:/config/AnesSystem.exe";
        long updateTimer=1000*60 ;
        List<MongoTypeFileModel> downLoadFiles = new List<MongoTypeFileModel>();

        string uploadIps = "";
        bool isNewAdd = false;
        DateTime upLoadTime;
        Version rollBackVersion;
        

        public AutoUpdateConfigModel()
        {
            killProcess = new List<string>()
            {
                "AnesAutoUpdate",
                "AnesSystem",
            };
            startProcess = new List<string>()
            {
                "BCCap.exe"
            };
        }

        public string StartExeLocalPath
        {
            get
            {
                return startExeLocalPath;
            }

            set
            {
                startExeLocalPath = value;
            }
        }

        public ObjectId StartExePath
        {
            get
            {
                return startExePath;
            }

            set
            {
                startExePath = value;
            }
        }

        public Version ServerVersion
        {
            get
            {
                return serverVersion;
            }

            set
            {
                serverVersion = value;
            }
        }

        public string UpdateDetial
        {
            get
            {
                return updateDetial;
            }

            set
            {
                updateDetial = value;
            }
        }

        public string UpdatePath
        {
            get
            {
                return updatePath;
            }

            set
            {
                updatePath = value;
            }
        }

        public string LocalRootPath
        {
            get
            {
                return localRootPath;
            }

            set
            {
                localRootPath = value;
            }
        }

        public List<string> KillProcess
        {
            get
            {
                return killProcess;
            }

            set
            {
                killProcess = value;
            }
        }

        public List<string> StartProcess
        {
            get
            {
                return startProcess;
            }

            set
            {
                startProcess = value;
            }
        }

        public bool IsReTipUpdate
        {
            get
            {
                return isReTipUpdate;
            }

            set
            {
                isReTipUpdate = value;
            }
        }

        public string ZhiDingDir
        {
            get
            {
                return zhiDingDir;
            }

            set
            {
                zhiDingDir = value;
            }
        }

        public string Qzsc
        {
            get
            {
                return qzsc;
            }

            set
            {
                qzsc = value;
            }
        }

        public string Qzgx
        {
            get
            {
                return qzgx;
            }

            set
            {
                qzgx = value;
            }
        }

        public bool IsDeleted
        {
            get
            {
                return isDeleted;
            }

            set
            {
                isDeleted = value;
            }
        }

        public string IsUpdateRunExe
        {
            get
            {
                return isUpdateRunExe;
            }

            set
            {
                isUpdateRunExe = value;
            }
        }

        public string IsUpdateMethodExe
        {
            get
            {
                return isUpdateMethodExe;
            }

            set
            {
                isUpdateMethodExe = value;
            }
        }

        public string MethodExeFullPath
        {
            get
            {
                return methodExeFullPath;
            }

            set
            {
                methodExeFullPath = value;
            }
        }

        public string RealStartExePath
        {
            get
            {
                return realStartExePath;
            }

            set
            {
                realStartExePath = value;
            }
        }

        public ObjectId RunExeDownLoadPath
        {
            get
            {
                return runExeDownLoadPath;
            }

            set
            {
                runExeDownLoadPath = value;
            }
        }

        public ObjectId ID
        {
            get
            {
                return _id;
            }

            set
            {
                _id = value;
            }
        }

        public string RunExeLocalPath
        {
            get
            {
                return runExeLocalPath;
            }

            set
            {
                runExeLocalPath = value;
            }
        }

        public List<MongoTypeFileModel> DownLoadFiles
        {
            get
            {
                return downLoadFiles;
            }

            set
            {
                downLoadFiles = value;
            }
        }

        public string RunExeName
        {
            get
            {
                return runExeName;
            }

            set
            {
                runExeName = value;
            }
        }

        public string StartExeName
        {
            get
            {
                return startExeName;
            }

            set
            {
                startExeName = value;
            }
        }

        public long UpdateTimer
        {
            get
            {
                return updateTimer;
            }

            set
            {
                updateTimer = value;
            }
        }

        public string UploadIps
        {
            get
            {
                return uploadIps;
            }

            set
            {
                uploadIps = value;
            }
        }

        public long ServerVersionId
        {
            get
            {
                return serverVersionId;
            }

            set
            {
                serverVersionId = value;
            }
        }

        public bool IsNewAdd
        {
            get
            {
                return isNewAdd;
            }

            set
            {
                isNewAdd = value;
            }
        }

        public string XuNiPath
        {
            get
            {
                return xuNiPath;
            }

            set
            {
                xuNiPath = value;
            }
        }

        public DateTime UpLoadTime
        {
            get
            {
                return upLoadTime.ToLocalTime();
            }

            set
            {
                upLoadTime = value;
                RaisePropertyChanged("UpLoadTime");
            }
        }

        public Version RollBackVersion
        {
            get
            {
                return rollBackVersion;
            }

            set
            {
                rollBackVersion = value;
            }
        }
    }
}
